import { Routes, Route } from 'react-router-dom';
import { Suspense, lazy } from 'react';

const Home = lazy(() => import('@/views/Home'));
const Message = lazy(() => import('@/views/Message'));
const My = lazy(() => import('@/views/My'));;
const NotFound = lazy(() => import('@/views/NotFound'));

function routesInit() {
  return (
    <>
      <Suspense fallback={<div>Loading</div>}>
        <Routes>
          <Route path="/" element={<Home />}></Route>
          <Route path="/home" element={<Home />}></Route>
          <Route path="/message" element={<Message />}></Route>
          <Route path="/my" element={<My />}></Route>
          <Route path="*" element={<NotFound />} />
        </Routes>
      </Suspense>
    </>
  );
}

export default routesInit;
